import { createStore } from 'vuex'
import hyRequest from '../../src/service/index'
import { loginApi } from '../service/login'

export default createStore({
  state: {
    name:'22222222222222222'
  },
  mutations: {
    //登录
    loginMut(state,data){
      hyRequest.post({url:'/login',data})
    }
  },
  actions: {
    //登录
    async loginAct({ commit, dispatch }, data: { name: string; password: string }) {
      await loginApi(data)
      commit('loginMut',data)
    }

  },
  modules: {
  }
})
